package wysiwyg.Options
{
	import flash.events.Event;
	
	import mx.collections.ArrayCollection;
	import mx.controls.HSlider;
	import mx.controls.NumericStepper;
	import mx.controls.TextArea;
	
	public class TextOptions extends OptionsBase
	{
		private var textArea:TextArea;
		private var numericStepper:NumericStepper;
		private var foregroundAlpha:HSlider;
		public function TextOptions(textArea:TextArea)
		{
			this.textArea=textArea;
			
			allOptions = new ArrayCollection();
			
			
			var fontOption:OptionsVO = new OptionsVO();
			fontOption.labelText = "Font Size";
			numericStepper =new NumericStepper()
			numericStepper.minimum=1;
			numericStepper.maximum=72;
			numericStepper.value=12;
			numericStepper.addEventListener(Event.CHANGE,fontSizeChanged);
			fontOption.uiComponent = numericStepper;
			allOptions.addItem(fontOption);	
			
			var foregroundAlphaOption:OptionsVO = new OptionsVO();
			foregroundAlphaOption.labelText = "Alpha";
			foregroundAlpha =new HSlider()
			foregroundAlpha.minimum=0;
			foregroundAlpha.maximum=1;
			foregroundAlpha.liveDragging=true;
			foregroundAlpha.value=1;
			foregroundAlpha.addEventListener(Event.CHANGE,foregroundAlphaChanged);
			foregroundAlphaOption.uiComponent = foregroundAlpha;
			allOptions.addItem(foregroundAlphaOption);	
		}
		private function fontSizeChanged(event:Event):void
		{
			textArea.setStyle("fontSize",numericStepper.value);
		}
		private function foregroundAlphaChanged(event:Event):void
		{
			textArea.alpha=foregroundAlpha.value;
		}

	}
}